﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using WebStudio.Business.Entity;
using WebStudio.Business.Rule;

public partial class AboutUs : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            loadData();
        }
    }

    public ArticalEntity articalEntity
    {
        get
        {
            if (string.IsNullOrEmpty(Request.QueryString["id"]))
            {
                return ArticalRule.GetArticalEntity(4, 1);
            }
            else
            {
                try
                {
                    int aid = Convert.ToInt32(Request.QueryString["id"]);
                    return ArticalRule.GetArticalEntity(aid);
                }
                catch
                {
                    return ArticalRule.GetArticalEntity(4, 1);
                }
            }
        }
    }

    private void loadData()
    {
        rptAboutBind();
        if (articalEntity == null)
        {
            ApplicationHelper.AddScriptBlock(this, "alert('该页面不存在');window.location.href='Default.aspx'");
        }
    }

    private void rptAboutBind()
    {
        rptAbout.DataSource = ArticalRule.GetArticalList(4);
        rptAbout.DataBind();
    }
}
